$OpenBSD: patch-src_kademlia_net_KademliaUDPListener_cpp,v 1.1 2012/04/10 13:08:37 dcoppa Exp $

Don't assert on ill-formed search requests
(upstream git commit e213af55f51b1fd34945c3afad3cdb7bfe605d6c)

--- src/kademlia/net/KademliaUDPListener.cpp.orig	Mon Jun 13 10:50:25 2011
+++ src/kademlia/net/KademliaUDPListener.cpp	Tue Apr 10 14:34:50 2012
@@ -793,14 +793,11 @@ SSearchTerm* CKademliaUDPListener::CreateSearchExpress
 		if (boolop == 0x00) { // AND
 			SSearchTerm* pSearchTerm = new SSearchTerm;
 			pSearchTerm->type = SSearchTerm::AND;
-			//TRACE(" AND");
-			if ((pSearchTerm->left = CreateSearchExpressionTree(bio, iLevel)) == NULL){
-				wxFAIL;
+			if ((pSearchTerm->left = CreateSearchExpressionTree(bio, iLevel)) == NULL) {
 				delete pSearchTerm;
 				return NULL;
 			}
-			if ((pSearchTerm->right = CreateSearchExpressionTree(bio, iLevel)) == NULL){
-				wxFAIL;
+			if ((pSearchTerm->right = CreateSearchExpressionTree(bio, iLevel)) == NULL) {
 				Free(pSearchTerm->left);
 				delete pSearchTerm;
 				return NULL;
@@ -809,14 +806,11 @@ SSearchTerm* CKademliaUDPListener::CreateSearchExpress
 		} else if (boolop == 0x01) { // OR
 			SSearchTerm* pSearchTerm = new SSearchTerm;
 			pSearchTerm->type = SSearchTerm::OR;
-			//TRACE(" OR");
-			if ((pSearchTerm->left = CreateSearchExpressionTree(bio, iLevel)) == NULL){
-				wxFAIL;
+			if ((pSearchTerm->left = CreateSearchExpressionTree(bio, iLevel)) == NULL) {
 				delete pSearchTerm;
 				return NULL;
 			}
-			if ((pSearchTerm->right = CreateSearchExpressionTree(bio, iLevel)) == NULL){
-				wxFAIL;
+			if ((pSearchTerm->right = CreateSearchExpressionTree(bio, iLevel)) == NULL) {
 				Free(pSearchTerm->left);
 				delete pSearchTerm;
 				return NULL;
@@ -825,14 +819,11 @@ SSearchTerm* CKademliaUDPListener::CreateSearchExpress
 		} else if (boolop == 0x02) { // NOT
 			SSearchTerm* pSearchTerm = new SSearchTerm;
 			pSearchTerm->type = SSearchTerm::NOT;
-			//TRACE(" NOT");
-			if ((pSearchTerm->left = CreateSearchExpressionTree(bio, iLevel)) == NULL){
-				wxFAIL;
+			if ((pSearchTerm->left = CreateSearchExpressionTree(bio, iLevel)) == NULL) {
 				delete pSearchTerm;
 				return NULL;
 			}
-			if ((pSearchTerm->right = CreateSearchExpressionTree(bio, iLevel)) == NULL){
-				wxFAIL;
+			if ((pSearchTerm->right = CreateSearchExpressionTree(bio, iLevel)) == NULL) {
 				Free(pSearchTerm->left);
 				delete pSearchTerm;
 				return NULL;
@@ -854,7 +845,7 @@ SSearchTerm* CKademliaUDPListener::CreateSearchExpress
 
 		// pre-tokenize the string term
 		//#warning TODO: TokenizeOptQuotedSearchTerm
-		wxStringTokenizer token(str, CSearchManager::GetInvalidKeywordChars(),wxTOKEN_DEFAULT );
+		wxStringTokenizer token(str, CSearchManager::GetInvalidKeywordChars(), wxTOKEN_DEFAULT );
 		while (token.HasMoreTokens()) {
 			wxString strTok(token.GetNextToken());
 			if (!strTok.IsEmpty()) {
